<template>
	<div>
		<!-- <NavTabs :tabs="navTagList" v-model="activeTag"></NavTabs> -->
		<div class="config-content">
			<div class="report" :style="{ width: processDataLength==0 || !nowRowData.approvalStatus ? '100%' : '68%' }">
				<ApplyReport
					:creditCode="userInfo.organizationId"
					v-if="activeTag == 2"
					v-bind="$attrs"
					:approvalStatus="nowRowData.approvalStatus"
					:isDetail="nowRowData.approvalStatus != 1 && nowRowData.approvalStatus != -1 && nowRowData.approvalStatus !== undefined"
					:list="nowRowData.tableRel"
					:params="params"
					:nowRowData="nowRowData"
					:applyNo="nowRowData.applyNo"
				></ApplyReport>
				<MaterialForm
					:creditCode="userInfo.organizationId"
					v-else-if="activeTag == 3"
					v-bind="$attrs"
					:approvalStatus="nowRowData.approvalStatus"
					:isDetail="nowRowData.approvalStatus != 1 && nowRowData.approvalStatus != -1 && nowRowData.approvalStatus !== undefined"
					:list="nowRowData.materialRel"
					:params="params"
					:applyNo="nowRowData.applyNo"
					:nowRowData="nowRowData"
				></MaterialForm>
				<ApplyReport
					:creditCode="userInfo.organizationId"
					v-else-if="activeTag == 4"
					v-bind="$attrs"
					:approvalStatus="nowRowData.approvalStatus"
					:isDetail="nowRowData.approvalStatus != 1 && nowRowData.approvalStatus != -1 && nowRowData.approvalStatus !== undefined"
					:list="nowRowData.dataRel"
					:params="params"
					:nowRowData="nowRowData"
					:applyNo="nowRowData.applyNo"
				></ApplyReport>
			</div>
			<slot></slot>
		</div>
	</div>
</template>

<script setup lang="ts">
import ApplyReport from '@/views/instOperate/components/ApplyReport/index.vue'
import MaterialForm from '@/views/instOperate/components/MaterialForm/index.vue'
import NavTabs from '@/views/instOperate/components/NavTabs/index.vue'
import { getStore } from '@/utils/store'
import bus from '@/utils/eventbus'

const props = defineProps<{
	nowRowData: any
}>()
// 接受到流程数据，判断流程有没有数据，从而决定布局
let processDataLength = ref(0)
bus.on('processData',(data)=>{
	if(data&&Array.isArray(data)){
		processDataLength.value = data.length
	}
})
const userInfo = getStore('userInfo') || {}
const activeTag = ref(2)
const params = ref({
	belongDate: props.nowRowData.belongDate,
	subsidyProjectId: props.nowRowData.subsidyProjectId,
	organizationId: userInfo.organizationId,
})

const navTagList = [
	{ label: '机构填报内容（申请表）', value: 2 },
	{ label: '机构填报内容（床位审核表）', value: 4 },
	{ label: '机构申请需要上传的材料', value: 3 },
]
</script>

<style scoped lang="scss">
.config-content {
	padding: 12px;
	margin-top: 20px;
	border: 1px solid #dcdcdc;
	border-radius: 10px;
	display: flex;
	.report {
		width: 70%;
	}
}
</style>
